package cz.cvut.fel.taskpro.data.imanager;

import cz.cvut.fel.taskpro.data.entity.*;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Local;

/**
 * This local interface specify database responsible action of data manager,
 * which is responsible for working with users.
 *
 * @author Tom
 * @version 1.0.0. beta
 */
@Local
public interface IUserData extends Serializable {

    /**
     * This method add user in parameter to dabase.
     *
     * @param userToAdd user to add to database.
     */
    public void addUser(TaskProUser userToAdd);

    /**
     * This method remove user in parameter from database.
     *
     * @param userToRemove user to remove from database.
     */
    public void removeUser(TaskProUser userToRemove);

    /**
     * This method find user in database based on login in paremeter.
     *
     * @param login login of students to find in database.
     * @return user in database based on login in paremeter. If no result found
     * then return null.
     */
    public TaskProUser findByLogin(String login);

    /**
     * This method find user in database based on email in paremeter.
     *
     * @param email email of students to find in database.
     * @return user in database based on email in paremeter. If no result found
     * then return null.
     */
    public TaskProUser findByEmail(String email);

    /**
     * This method update user in parameter in database.
     *
     * @param userToUpdate user to update to DB.
     */
    public void updateUser(TaskProUser userToUpdate);

    /**
     * This method find in database all users.
     *
     * @return <code>List</code> of all users in database
     */
    public List<TaskProUser> getAllUsers();

    /**
     * This method find in database all students.
     *
     * @return <code>List</code> of all students in database
     */
    public List<Student> getAllStudents();

    /**
     * This method find in database all kantors.
     *
     * @return <code>List</code> of all kantors in database
     */
    public List<Kantor> getAllKantors();
    /**
     * This method find in database students which learn kantor in parameter.
     * @param kantor kantor who teach students which will be found.
     * @return <code>List</code> of all students which learn kantor in parameter. If no result 
     * is found then return empty list.
     */
    public List<Student> getAllStudentByKantor(Kantor kantor);
    /**
     * This method find all students which are part of one of group in parameter.
     * Parameter cant be null or empty.
     * @param groups groups which are founded students part of.
     * @return <code>List</code> of all students which are part of one of group in parameter. Order by 
     * surname ascendat. If no result is found then return empty list.
     */
    public List<Student> getStudentsByGroup(List<GroupTaskPro> groups);
    /**
     * This method find in DB all students which are part of one of team in parameter.
     * Parameter cant be null or empty.
     * @param teams teams which are founded students part of.
     * @return <code>List</code> of all students which are part of one of team in parameter.
     * Ordered by surname ascendant. If no result is found then return empty list.
     * 
     */
    public List<Student> getStudentsByTeam(List<Team> teams);
    /**
     * This method find in DB all students which are in group in parameter.
     * @param group group in which are founded students part of.
     * @return <code>List</code> of all students which are in group in parameter. Order by 
     * surname ascendant. If no result is found then return empty list.
     */
    public List<Student> getStudentsByGroup(GroupTaskPro group);
    /**
     * This method find in DB all students which teach kantor in parameter
     * and which are part of subject in parameter.
     * @param kantor kantor who teach teach students.
     * @param subject subject in which are founded students part of.
     * @return <code>List</code> of all students which teach kantor in parameter
     * and which are part of subject in parameter. Order by login ascendant. 
     * If no result is found then return empty list.
     */
    public List<Student> getStudentByContext(Kantor kantor, Subject subject);
    /**
     * This method find all students in database which are not in team in group in 
     * parameter.
     * @param group group in which will be founded students who are not in team.
     * @return <code>List</code> of all students in database which are not in team in group in 
     * parameter. Ordered by login ascendant. If no result is found then return empty list.
     */
    public List<Student> getStudentNotInTeam(GroupTaskPro group);
}